package org.example.baseinfo.common.vo;


public interface IError {
    DefaultErrorEnum GENERAL_ERROR = DefaultErrorEnum.GENERAL_ERROR;
    DefaultErrorEnum SYSYTEM_UNKNOW = DefaultErrorEnum.SYSYTEM_UNKNOW;
    DefaultErrorEnum PARAM_CHECK_FAILD = DefaultErrorEnum.PARAM_CHECK_FAILD;
    DefaultErrorEnum DATA_NOT_EXIST = DefaultErrorEnum.DATA_NOT_EXIST;
    DefaultErrorEnum FEIGN_FAIL = DefaultErrorEnum.FEIGN_FAIL;

    String getCode();
    String getMsg();

    enum DefaultErrorEnum implements IError{
        GENERAL_ERROR("-1","通用错误"),
        SYSYTEM_UNKNOW("900000", "系统未知错误"),
        PARAM_CHECK_FAILD("900101", "参数校验失败"),
        DATA_NOT_EXIST("900200", "数据不存在"),
        FEIGN_FAIL("900102","Feign服务调用异常")
        ;

        private String code;
        private String msg;

        DefaultErrorEnum(String code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        @Override
        public String getCode() {
            return code;
        }

        @Override
        public String getMsg() {
            return msg;
        }
    }
}
